package xyz.eden.cloud.common.web.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import xyz.eden.cloud.common.core.enums.ICodeDescEnum;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum DeletedEnum implements ICodeDescEnum<Long> {

    /**
     * 未删除
     */
    NORMAL(0L, "未删除"),
    /**
     * 已删除
     */
    DELETED(System.currentTimeMillis(), "已删除");
    private final Long code;
    private final String desc;

    /**
     * 通过 code 获取删除状态
     *
     * @param code
     * @return
     */
    public static DeletedEnum getByStat(Long code) {
        return Objects.equals(code, NORMAL.getCode()) ? NORMAL : DELETED;
    }
}
